package main

import (
	"os"
	"os/exec"

	"github.com/spf13/cobra"
)

// 执行获取物理磁盘列表命令

func runArcconfGetPdList(cmd *cobra.Command, args []string) error {
	toolPath, err := extractTool("tools/arcconf")
	if err != nil {
		return err
	}

	arcconfCmd := exec.Command(toolPath, "GETCONFIG", "1", "PD")
	arcconfCmd.Stdin = os.Stdin
	arcconfCmd.Stdout = os.Stdout
	arcconfCmd.Stderr = os.Stderr

	return arcconfCmd.Run()
}

// 执行获取逻辑磁盘列表命令
func runArcconfGetLdList(cmd *cobra.Command, args []string) error {
	toolPath, err := extractTool("tools/arcconf")
	if err != nil {
		return err
	}

	arcconfCmd := exec.Command(toolPath, "GETCONFIG", "1", "LD")
	arcconfCmd.Stdin = os.Stdin
	arcconfCmd.Stdout = os.Stdout
	arcconfCmd.Stderr = os.Stderr

	return arcconfCmd.Run()
}
